<%--
  Created by IntelliJ IDEA.
  User: 王鹏飞
  Date: 2020/7/21
  Time: 10:35
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<jsp:include page="../common/menu.jsp" />

<html>
<head>
    <title>单车查询</title>
</head>

<script src="<%=basePath%>js/tools.js"></script>
<body>
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">单车查询</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-inline">
            <label class="layui-form-label">车牌号码</label>
            <div class="layui-input-inline">
                <select name="vehicleNum" id="vehicleNumId" class="layui-input" style="width: 150px;" lay-filter="vehicleNum">
                    <option value="">请选择车牌号码</option>
                    <c:forEach var="vehicle" items="${vehicleInfos}">
                        <option value="${vehicle.vehicleNum }">${vehicle.vehicleNum }</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <button class="layui-btn" id="selCond" data-type="reload">搜索</button>
    </div>

    <div class="layui-tab-item layui-show">
        <table class="layui-hide" id="backUser" lay-filter="backUser"></table>
    </div>
</div>

<script type="text/html" id="startTime">
    {{ dateFormat(d.startTime) }}
</script>

<script type="text/html" id="createTime">
    {{ dateFormat(d.createTime) }}
</script>

</body>
</html>
<jsp:include page="../common/js.jsp" />

<script type="text/javascript">

    $('document').ready(function() {
        var layer = null;
        var laypage = null;
        var table = null;
        var form = null;
        layui.use([ "laypage", "layer", 'table' ,'laydate'], function() {
            layer = layui.layer;
            laypage = layui.laypage;
            table = layui.table;
            form = layui.form;
            laydate = layui.laydate;

            table.render({
                elem : '#backUser',
                url : '<%=basePath%>settlement/settlementList',
                id : 'backUser',
                height:650,
                toolbar : '#toolbar',
                cellMinWidth : 100,
                cols : [ [
                    {
                        field : 'id',
                        title : '编号',
                        width : '5%',
                        unresize : true,
                        sort : true
                    }
                    , {
                        field : 'vehicleNum',
                        title : '车牌号',
                        width : '10%',
                        unresize : true,
                        sort : true
                    }
                    , {
                        field : 'settlement',
                        width : '13%',
                        align : 'center',
                        title : '结算年月'
                    }
                    , {
                        field : 'totalMoney',
                        title : '总营业额',
                        width : '10%',
                        unresize : true
                    }
                    , {
                        field : 'totalKilometres',
                        title : '总公里数',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'totalAmount',
                        title : '费用总计',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'grossProfit',
                        title : '毛利润',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'fuelMoney',
                        title : '油费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'bridgeMoney',
                        title : '过桥费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'stopMoney',
                        title : '停车费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'repairMoney',
                        title : '修理费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'tireMoney',
                        title : '轮胎费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'subsidizeMoney',
                        title : '车补贴',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'wages',
                        title : '工资',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'gpsMoney',
                        title : 'GPS费用',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'premium',
                        title : '保险费',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'loan',
                        title : '还贷',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'dividends',
                        title : '分红',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'otherMoney',
                        title : '其他',
                        width : '10%',
                        sort : true
                    }
                    , {
                        field : 'createTime',
                        title : '操作日期',
                        width : '10%',
                        templet : '#createTime',
                        sort : true
                    }
                    , {
                        field : 'remark',
                        title : '备注',
                        width : '12%',
                        unresize : true
                    }
                    , {
                        field : 'createBy',
                        title : '创建人',
                        width : '10%',
                        sort : true
                    }
                ] ],
                page : true
            });

            $("#selCond").click(function(){
                var vehicleNum = $("#vehicleNumId").val();

                table.reload('backUser',{
                    url:'<%=basePath %>/settlement/settlementListByCond'
                    ,method:'get'
                    ,where:{
                        vehicleNum : vehicleNum
                    }
                    ,page:{
                        curr:1
                    }
                });
            });

        });
    });

    function changeStatus(str) {
        var typeName = new Map();
        typeName.set(1, '未审核-未收款');
        typeName.set(2, '已审核-未收款');
        typeName.set(3, '已完成-已收款');
        typeName.set(0, '已取消');
        return typeName.get(str);
    }
</script>